package MicroGZM;

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

import MicroGZM.mesh.Mesh;

public class MicroGZM {
	
	private static final String TITLE = "Micro Gizmo - Java / OpenGL 3D Engine";
	private static final int WIDTH = 640;
	private static final int HEIGHT = 480;
	
	private Mesh mesh;
	private MicroGZMRenderer renderer;
	
	public MicroGZM() {
		try {
			Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
			Display.setTitle(TITLE);
			Display.create();
		} catch (LWJGLException e) {
			e.printStackTrace();
		}

		setupModels();
		setupRenderer();
		
		while(!Display.isCloseRequested()){
			
			//GAME LOOP
			renderer.update();
			input();
			
			Display.update();
			Display.sync(60);
		}
		
		Display.destroy();
		System.exit(0);
	}

	private void input() {
		// TODO Auto-generated method stub
		
	}

	private void setupModels() {
		mesh = new Mesh();
		mesh.loadFile("res/mesh/cube.obj");		
	}

	private void setupRenderer() {
		
		renderer = new MicroGZMRenderer();
		renderer.addMesh(mesh);
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new MicroGZM();
	}

}
